import 'package:cached_network_image/cached_network_image.dart';
import 'package:demo_app_video/commons/http/http.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class AboutUsPage extends StatefulWidget {
  const AboutUsPage({Key? key}) : super(key: key);

  @override
  State<AboutUsPage> createState() => _AboutUsPageState();
}

class _AboutUsPageState extends State<AboutUsPage> {
  Map objData = {'kefu_weixin': '', 'kefu_email': '', 'kefulinkimg': ''};

  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    get_datas();
  }

  get_datas() async {
    var resultData = await HttpUtil.getInstance().get('index/sys_config');
    objData = resultData['data'];
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color(0xffFFFFFF),
      appBar: AppBar(
        elevation: 0,
        scrolledUnderElevation: 0,
        title: Text(
          '联系客服',
          style: TextStyle(fontSize: 16.sp),
        ),
        centerTitle: true,
        backgroundColor: Color(0xffFFFFFF),
      ),
      body: SingleChildScrollView(
        padding: EdgeInsets.all(0),
        child: Column(
          children: [
            Container(
              width: 360.w,
              height: 50.h,
              padding: EdgeInsets.only(left: 16.w, right: 16.w),
              decoration: BoxDecoration(
                  border: Border(
                      bottom:
                          BorderSide(color: Color(0xffECECEC), width: 1.sp))),
              child: Row(
                children: [
                  Text(
                    '客服邮箱:',
                    style: TextStyle(color: Color(0xff333333), fontSize: 12.sp),
                  ),
                  Expanded(child: Container()),
                  Text(
                    '${objData['kefu_email']}',
                    style: TextStyle(color: Color(0xff333333), fontSize: 12.sp),
                  ),
                ],
              ),
            ),
            Container(
              width: 360.w,
              height: 50.h,
              padding: EdgeInsets.only(left: 16.w, right: 16.w),
              decoration: BoxDecoration(
                  border: Border(
                      bottom:
                          BorderSide(color: Color(0xffECECEC), width: 1.sp))),
              child: Row(
                children: [
                  Text(
                    '客服微信:',
                    style: TextStyle(color: Color(0xff333333), fontSize: 12.sp),
                  ),
                  Expanded(child: Container()),
                  Text(
                    '${objData['kefu_weixin']}',
                    style: TextStyle(color: Color(0xff333333), fontSize: 12.sp),
                  ),
                ],
              ),
            ),
            Container(
              height: 30.h,
            ),
            objData['kefulinkimg'] == ''
                ? Container()
                : CachedNetworkImage(
                    imageUrl: '${objData['kefulinkimg']}',
                    width: 150.w,
                    height: 150.w,
                  )
          ],
        ),
      ),
    );
  }
}
